package com.nycreativity.elecreativity.config.ijpay.paypal;

import com.ijpay.paypal.PayPalApiConfig;
import com.ijpay.paypal.PayPalApiConfigKit;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sxt
 * @version 1.0
 * @description TODO
 * @date 2021/6/1 12:15 上午
 */
@Component
@ConfigurationProperties(prefix = "ijpay.paypal")
public class CustomPayPalApiConfigKit {

    /**
     * PayPal配置集合
     */
    private List<PayPalApiConfig> payPalApiConfigs = new ArrayList<>();

    public List<PayPalApiConfig> getPayPalApiConfigs() {
        return payPalApiConfigs;
    }

    public void setPayPalApiConfigs(List<PayPalApiConfig> payPalApiConfigs) {
        this.payPalApiConfigs = payPalApiConfigs;
        for (PayPalApiConfig config : payPalApiConfigs) {
            PayPalApiConfigKit.setThreadLocalApiConfig(config);
        }
    }

}
